package com.jboost.modules.file.service.impl;

import com.jboost.config.mybatis.TenantContext;
import com.jboost.modules.file.entity.JboostFile;
import com.jboost.modules.file.mapper.JboostFileMapper;
import com.jboost.modules.file.service.IJboostFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * @Description: jboost_file
 * @Author: cxn
 * @Date:   2021-05-11
 * @Version: V1.0
 */
@Service
public class JboostFileServiceImpl extends ServiceImpl<JboostFileMapper, JboostFile> implements IJboostFileService {

    @Override
    public void updateStoreId(String fileId, String storeId) {
        this.baseMapper.updateStoreId(fileId,storeId);
    }

    @Override
    public JboostFile getByFileKey(String fileKey) {
        return this.lambdaQuery().eq(JboostFile::getFileKey,fileKey).orderByDesc(JboostFile::getCreateTime).last("limit 1").one();
    }
}
